﻿using System;
using System.Collections.Generic;
using System.Text;
using SH;

namespace MTS
{
    internal class mtStation : mtObject
    {
        ulong m_handle;
        string m_szName;       //站点名称
        string m_szGuid;
        string m_szLocation;   //位置
        emStationType m_stype;
        emProgramType m_ptype;
        List<string> m_vecLocation = new List<string>();


        mtStationInfo m_info;

        public mtStation(mtRegisterInfo info)
        : base(0)
        {
            m_szName = info.StationName;
            m_szLocation = info.Location;
            m_stype = info.StationType;
            m_ptype = info.ProgramType;

            m_info = new mtStationInfo(info.StationName, info.Location, "", info.StationType, info.ProgramType, false);

        }

        public mtStation(string szName, string szGuid, string szLocation, emStationType st, emProgramType pt)
        : base(0)
        {
            m_szName = szName;
            m_szGuid = szGuid;
            m_stype = st;
            m_ptype = pt;
            m_info = new mtStationInfo(szName, szLocation, szGuid, st, pt, false);
        }



        public ulong Handle() { return m_handle; }
        public void Handle(ulong hStation) { m_handle = hStation; }

        public string Name { get => m_szName; }

        public string Guid { get => m_szGuid; set => m_szGuid = value; }



        public void StationType(emStationType type)
        {
            m_stype = type;
        }

        public void ProgramType(emProgramType type)
        {
            m_ptype = type;
        }

        public emStationType StationType() {
            return m_stype;
        }

        public emProgramType ProgramType() {
            return m_ptype;
        }

        public string Location() {
            return m_szLocation;
        }

      static public bool operator ==(mtStation l,mtStation r)
        {
            if (l.m_szName != r.m_szName) return false;
            if (l.m_szGuid != r.m_szGuid) return false;
            if (l.m_stype != r.m_stype) return false;
            if (l.m_ptype != r.m_ptype) return false;
            //if (other.m_szLocation != m_szLocation) return false;

            return true;
        }

        static public bool operator !=(mtStation l, mtStation r)
        {
            if (l.m_szName != r.m_szName) return true;
            if (l.m_szGuid != r.m_szGuid) return true;
            if (l.m_stype != r.m_stype) return true;
            if (l.m_ptype != r.m_ptype) return true;

            return false;
        }

        static public bool operator < (mtStation l, mtStation r)
        {
            if (l.m_szName.CompareTo(r.m_szName)< 0) return true;
            if (l.m_szGuid.CompareTo(r.m_szGuid) < 0) return true;
            if (l.m_stype < r.m_stype) return true;
            if (l.m_ptype < r.m_ptype) return true;
            //if (other.m_szLocation < other.m_szLocation) return true;

            return false;
        }

        static public bool operator >(mtStation l, mtStation r)
        {
            if (l.m_szName.CompareTo(r.m_szName) > 0) return false;
            if (l.m_szGuid.CompareTo(r.m_szGuid) > 0) return false;
            if (l.m_stype > r.m_stype) return false;
            if (l.m_ptype > r.m_ptype) return false;
            //if (other.m_szLocation < other.m_szLocation) return true;

            return true;
        }

      public  override bool   Equals(object o)
        {
            return this == (mtStation)o;
        }

        public List<string> Locations()
        {
            return m_vecLocation;
        }


        public mtStationInfo GetStationInfo()
        {
            return m_info;
        }


    }
}
